﻿using System;
using System.Reflection;

namespace Basmus.Values
{
    public class PropertyInfoBuilder<T> : PropertyInfoBuilderBase<T>
    {
        private readonly Func<ValuesContext, PropertyInfo, T> _builder;

        public PropertyInfoBuilder(IPropertyInfoBuilder propertyInfoBuilder, Func<ValuesContext, PropertyInfo, T> builder)
            : base(propertyInfoBuilder)
        {
            _builder = builder;
        }

        protected override T Build(ValuesContext valuesContext, PropertyInfo propertyInfo)
        {
            return _builder(valuesContext, propertyInfo);
        }
    }
}